/**
 * 运动计算引擎 2D
 */
var LBMovement2D    = function () {}

LBMovement2D._instance      = null;

LBMovement2D.getInstance    = function () {

    if (null == LBMovement2D._instance) {

        LBMovement2D._instance  = new LBMovement2D;
    }

    return  LBMovement2D._instance;
}

LBMovement2D.prototype.run  = function (speedList, delayTime) {

    var deltaX  = 0;
    var deltaY  = 0;

    for (var offsetSpeed;offsetSpeed < speedList.length; offsetSpeed ++) {

        deltaX  += speedList[offsetSpeed].getDeltaX(delayTime);
        deltaY  += speedList[offsetSpeed].getDeltaY(delayTime);
    }

    return  {
        "deltaX"    : deltaX,
        "deltaY"    : deltaY
    }
}

LBMovement2D.prototype.roll = function (speedList, delayTime) {

    var deltaDirection  = 0;

    for (var offsetSpeed;offsetSpeed < speedList.length; offsetSpeed ++) {

        deltaDirection  += speedList[offsetSpeed].getDeltaDirection(delayTime);
    }

    return  deltaDirection;
}

